<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.10/semantic.min.css">
    <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css">
    <link rel="stylesheet" href="../../static/css/mycss.css">
    <title>分类新增</title>
</head>
<body>
<!--导航-->
<nav th:replace="admin/_fragments :: menu(3)" class="ui inverted attached segment my-padding-small my-shadow-small"><!--attached会连接上一个模块，没有缝隙-->
    <div class="iu container">
        <div class="ui inverted secondary stackable menu"> <!--menu导航条;   stackable会让导航栏以堆积的方式适应屏幕-->
            <h2 class="ui teal header item">管理后台</h2>  <!--item让这部分成为导航栏的条目-->
            <a href="" class="my-item item my-mobile-hide"><i class="home icon"></i>博客</a>
            <a href="" class="active my-item item my-mobile-hide"><i class="idea icon"></i>分类</a>
            <a href="" class="my-item item my-mobile-hide"><i class="tags icon"></i>标签</a>
            <div class="right my-mobile-hide menu">
                <div class="ui dropdown item"><!--dropdown效果是鼠标放在item时会让该部分更显眼；-->
                    <div class="text">
                        <img class="ui avatar image" src="../../static/image/山城.jpg">
                        承太郎
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="" class="item">注销</a>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <div href="" class="ui my-menu toggle black icon button my-right-top my-mobile-show">
        <i class="sidebar icon"></i><!--三条横杠图标-->
    </div>
</nav>
<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a href="" th:href="@{/admin/tags/input}" class="active item">发布</a>
            <a href="" th:href="@{/admin/tags}" class="teal item">列表</a>
        </div>

    </div>
</div>

<!--中间-->
<div class="my-container-small my-padding-large">
    <div class="ui container">
        <form action="#" method="post" th:action="*{id}==null ? @{/admin/tags} : @{/admin/tags/{id}(id=*{id})}" th:object="${tag}" class="ui form" >

            <div class="required field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">名称</label>
                    <input type="text" name="name" placeholder="分类名称" th:value="*{name}">
                </div>
            </div>

            <div class="ui error message"></div>

            <!--/*/<div class="ui negative message" th:if="${#fields.hasErrors('name')}">
                <i class="close icon"></i>
                <div class="header">验证失败</div>
                <p th:errors="*{name}">提交信息为空</p>
            </div>/*/-->

            <div class="ui right aligned container">
                <button class="ui button" type="button" onclick="window.history.go(-1)">返回</button>
                <!--onclick="window.history.go(-1)"效果是回到原来界面-->
                <button class="ui teal submit button">提交</button><!--加了submit，按回车就可以提交-->
            </div>

        </form>
    </div>
</div>

<br>
<br>
<br>
<br>
<br>
<br>
<br>

<!--底部-->
<footer th:replace="admin/_fragments :: footer" class="ui inverted vertical segment my-padding-massive">
    <div class="ui container diy_dp">
        <div class="ui stackable center aligned inverted divided grid">
            <div class="three wide column">
                <img src="../../static/image/微信.jpg" class="ui rounded image centered aligned" alt="" style="width: 130px">
            </div>

            <div class="three wide column">
                <h4 class="ui inverted header">最新博客</h4>
                <div class="ui inverted link list"></div>
                <a href="" class="item">碧蓝航线攻略</a><br>
                <a href="" class="item">游戏抽奖技巧</a><br>
                <a href="" class="item">如何与傻逼交流</a>
            </div>

            <div class="three wide column">
                <h4 class="ui inverted header">最新博客</h4>
                <div class="ui inverted link list"></div>
                <a href="" class="item">碧蓝航线攻略</a><br>
                <a href="" class="item">游戏抽奖技巧</a><br>
                <a href="" class="item">如何与傻逼交流</a>
            </div>

            <div class="seven wide column">
                <h4 class="ui inverted header">最新博客</h4>
                <p class="my-text-spaced my-text-thin my-opacity-mini">这是我的个人博客，赶紧进去看看，你们不要不知好歹</p>
            </div>

        </div>
        <div class="ui inverted section divider"></div>
        <p class="my-text-spaced my-text-thin my-opacity-tiny">Copyright @ 2021-2022 MrWuu Designed by MrWuu</p>
    </div>

</footer>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.10/semantic.min.js"></script>


<script>

    //初始化markdown编译器
    $('.my-menu.toggle').click(function () {
        $('.my-item').toggleClass('my-mobile-hide');
        /*toggleClass效果：点击之后如果有my-mobile-hide这一个样式就去除掉
        如果没有则加上去*/
        /*这个js原理是先获取.my-menu toggle的作用域再把后面点击之后的效果加上来
            点击效果是由获取.my-item的作用域,加上toggleClass给的功能组成的*/
    });

    $('.ui.dropdown').dropdown({
        on: 'hover'
    })
    /*效果是鼠标放到ui dropdown样式上，里面的内容就会出来，例：鼠标放在头像上显示注销*/
    ;

    $('.ui.form').form({   /*获取ui.form表单，调用form方法*/
        fields: { /*指定区域*/
            title: {
                identifier: 'name', /*根据name指定生效在哪个组件*/
                rules: [{       /*指定规则*/
                    type: 'empty',  /*非空验证*/
                    prompt: '请输入分类名称' /*提示内容*/
                }]
            }
        }
    });

</script>

</body>
</html>